package com.susu.springboot_swagger.service;

import com.susu.springboot_swagger.entity.MedicalAssay;
import com.susu.springboot_swagger.mapper.MedicalAssayDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

@Service
public class MedicalAssayService {

    @Autowired
    private MedicalAssayDao medicalAssayDao;

    public List<MedicalAssay> getList(MedicalAssay medicalAssay) {
        List<MedicalAssay> medicalAssayList = medicalAssayDao.queryAllBy(medicalAssay);
        return medicalAssayList;
    }

    public Boolean addMedicalAssay(MedicalAssay medicalAssay) {
        medicalAssay.setAssayResult(0);
        if (medicalAssayDao.insert(medicalAssay)>0) {
            return true;
        }
        return false;
    }

    public boolean confirmation(Integer id) {
        MedicalAssay medicalAssay = new MedicalAssay();
        medicalAssay.setId(id);
        medicalAssay.setAssayResult(1);
        if (medicalAssayDao.update(medicalAssay)>0) {
            return true;
        }
        return false;
    }
}
